<template>
	<view class="container">
		<view class="content">
			<view class="logo">
				<img src="/static/meituan_logo.png" alt="logo">
			</view>
			<view class="btns">
				<view class="login" @click="login()">微信登录</view>
				<view class="others">手机号登录/注册</view>
			</view>
			<label class="radio agree"><radio value="r1" checked="true" color="#F9D173" style="transform:scale(0.5)" />
				登录代表您已同意 <span class="color">美团用户协议</span>、<span class="color">隐私协议</span>
			</label>
		</view>	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {} // 用户信息
			}
		},
		methods: {
			// 登录
			login() {
				uni.getUserProfile({
					desc: '用户信息仅供订餐使用',
					success(res) {
						const userInfo = {
							rawData: JSON.parse(res.rawData),
							signature: res.signature
						}
						// 将用户信息存储到缓存
						uni.setStorageSync('userInfo', JSON.stringify(userInfo))
						// 跳转到个人页面
						uni.reLaunch({
							url: '/pages/my/my?userInfo=' + JSON.stringify(userInfo)
						})
					},
					fail(error) {
						return new Promise(() =>{})
					}
				})
			}
		},
		mounted() {
			
		}
	}
</script>

<style lang="scss" scoped>
.container {
	background-color: #fff !important;
	flex-direction: column;
	justify-content: space-around;
	.content {
		height: 640upx;
		display: flex;
		flex-direction: column;
		align-items: center;
		.logo {
			width: 324upx;
			height: 96upx;
			margin-bottom: 100upx;
			img {
				width: 100%;
				height: 100%;
			}
		}
	}
	
	.btns {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		.login {
			width: 80%;
			height: 80upx;
			line-height: 80upx;
			font-size: 28upx;
			text-align: center;
			border-radius: 10upx;
			background-color: $theme-color;
			margin-bottom: 30upx;
		}
		.others {
			width: 80%;
			height: 60upx;
			line-height: 60upx;
			font-size: 28upx;
			text-align: center;
			border-radius: 10upx;
			border: 1upx solid $textLightGray-color;
			margin-bottom: 20upx;
		}
	}
	
	.agree {
		font-size: 20upx;
		.color {
			color: $theme-color;
		}
	}
	
}
</style>